package net.comm.user.db;


import java.sql.ResultSet;
import java.sql.SQLException;

import net.comm.user.bean.BaseUserHome;
import net.comm.user.bean.BaseUserSet;
import net.comm.util.StringUtil;

import org.sakaiproject.db.api.SqlReader;

public class DbUserHomeService implements SqlReader
{

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{
			
			int  	seqID = result.getInt(1);			//	序号ID
			int  	userID = result.getInt(2);			//	会员ID
			int  	work_location = result.getInt(3);	//	所在省份
			int  	work_sublocation = result.getInt(4);	//	所在城市
			int  	work_area = result.getInt(5);			//	所在区县
			int  	villageID = result.getInt(6);			//	小区
			String  building = StringUtil.getValue(result.getString(7));			//	栋
			String  houseNo = StringUtil.getValue(result.getString(8));			//	号
			String  fangchanNo = StringUtil.getValue(result.getString(9));			//	房产证号码
			String  fcNoSet = StringUtil.getValue(result.getString(10));			//	房产证号码隐私保护
			int  	fcPicID = result.getInt(11);			//	房产证照片ID
			String  fcPicIDSts = StringUtil.getValue(result.getString(12));			//	房产证照片状态
			String  inTime = StringUtil.getValue(result.getString(13));			//	入住时间
			String  inTimeSet = StringUtil.getValue(result.getString(14));			//	入住时间隐私保护
			String  famSts = StringUtil.getValue(result.getString(15));			//	家庭状况
			String  famStsSet = StringUtil.getValue(result.getString(16));			//	家庭状况隐私保护
			String  liveSts = StringUtil.getValue(result.getString(17));		//	居住状况
			String  liveStsSet = StringUtil.getValue(result.getString(18));		//	居住状况隐私保护
			String  mtime = StringUtil.getValue(result.getString(19));			//	最后修改日期			
						
			// create the Resource from these fields
			return new BaseUserHome(  seqID,  userID,  work_location, work_sublocation,  work_area,  villageID,
					 building,  houseNo,  fangchanNo, fcNoSet, fcPicID, fcPicIDSts,  inTime,  inTimeSet,  famSts,
					 famStsSet,  liveSts,  liveStsSet,  mtime );
		}
		catch (SQLException e)
		{
			return null;
		}
		
	}
}
